package com.pj.project.controller;

import com.pj.project.model.mapper.SpCategoryMapper;
import com.pj.project.model.pojo.SpCategory;
import com.pj.project.model.vo.SpCategoryVO;
import com.pj.project.service.SpCategoryService;
import com.pj.utils.sg.AjaxJson;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * CategoryController
 *
 * @author hanWu
 * 2022-12-17 22:07
 */
@RestController
@RequestMapping("/role")
public class CategoryController {
    @Resource
    SpCategoryService spCategoryService;

//    查询目录列表
    @GetMapping("{id}/menu")
    public AjaxJson list(@PathVariable("id") Long id){
        List<SpCategoryVO> spCategoryVOList = spCategoryService.listVo(id);
        return AjaxJson.getSuccessData(spCategoryVOList);
    }
}
